package de.upb.aquarium.api.objects;

import javax.media.opengl.GL;

import objimp.ObjImpScene;

/**
 * A static object in a 3D-World.
 * Can be initialized with the filename of a model, or override the paint-method to draw directly.
 * @author Alexander
 */
public class StaticObject extends General3DObject {

	ObjImpScene object;
	String filename; 
	boolean culling;


	public StaticObject(GL gl, String filename, float scale) {
		object = new ObjImpScene(gl);
		object.load(filename, scale);
		this.filename = filename;
	}
	
	public StaticObject(GL gl, String filename, float scale, boolean culling) {
		this(gl,filename,scale);
		this.culling = culling;
	}

	@Override
	public void paint(GL gl) {
		beforeRendering(gl);
		if (culling)
		gl.glEnable(GL.GL_CULL_FACE);
		object.draw(gl);
		if (culling)
		gl.glDisable(GL.GL_CULL_FACE);
		afterRendering(gl);
	}
}
